package com.example.springboot_demo.demos.web.book_work.Exception;


import com.example.springboot_demo.Common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
public class ExceptionHandlers {


    public static String name;

    /**
     * 捕获业务异常
     * @param ex
     * @return
     */
    @ExceptionHandler
    public Result exceptionHandler(LibraryException ex){
        return Result.error(ex.getMessage());
    }
}
